<template>
  <div class="box">
    <!-- 面包屑导航区 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>数据统计</a></el-breadcrumb-item>
      <el-breadcrumb-item>数据报表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
        <lineChart :reportData="reportData" v-if="Object.keys(reportData).length > 0"/>
    </el-card>
  </div>
</template>

<script>
import lineChart from "./lineChart.vue";
export default {
  components: {
    lineChart,
  },
  data() {
    return {
      reportData: {},
    };
  },
  methods: {
    async getReportData() {
      // get 方法返回一个 promise 对象
      const { data: res } = await this.$axios.get("reports/type/1");
      if (res.meta.status != 200) {
        return this.$message.error(res.meta.msg);
      }
      this.$message.success(res.meta.msg);
      this.reportData = res.data;
    },
  },
  created() {
    this.getReportData();
  },
};
</script>

<style>
</style>